var contractId;

$(function(){
   var data = {
		method: 'get',
		url:path+'/procurement/procurement-contract',
		contentType: 'application/x-www-form-urlencoded',
		columns: [{
			field: 'checked',
			checkbox: true
		}, {
			field: 'procureConId',
			visible: false
		}, {
			field: 'procureConOrderNumber',
			title: '采购计划单号'
		}, {
			field: 'procureConProcureEnterprise',
			title: '采购公司'
		}, {
			field: 'procureConProcureAgent',
			title: '(采购)委托代理人'
		}, {
			field: 'procureConSupplierEnterprise',
			title: '供货公司'
		}, {
			field: 'procureConSupplyAgent',
			title: '(供货)委托代理人'
		}, {
			field: 'procureConSigningTitme',
			title: '签约日期'
		}, {
			field: 'procureConSigningAddress',
			title: '签约地址'
		},{
			field: 'procureConBrowse',
			title: '合同预览',
			formatter: function (value, row, index) {
				return "<button class='layui-btn layui-btn-primary' onclick=queryContract('"+row.procureConId+"')>查看合同</button>";
			}
			
		}],	
		sortable: true,
        sortOrder: "asc",
        search: false,
   }
   
   var param = [{text:"供货公司",name:"procureConSupplierEnterprise",type:"text",verify:"enterpriseName"},{text:"签约日期",name:"dateScope",type:"text",verify:""},{text:"签约地址",name:"procureConSigningAddress",type:"text",verify:"cnw"}];
 
   renderTable(cTable,data);
   
   createQueryPanel(param);
   
   laydate.render({
	   elem: '[name="dateScope"]'
	   ,range: true
   });
   
   form.render();
})
//添加按钮
$("#add_btn").click(function(){
	openOperateWindow({
		title: '添加采购合同',
		iframeAuto: true,
		url: '/admin/enterpriseManagement/procurementManagement/procurementContract/procurement-contract-add.jsp'
	})
})

//删除按钮
$("#remove_btn").click(function(){
	requestRemoveData("procureConId","/procurement/procurement-contract");
})

//修改按钮
$("#modify_btn").click(function(){
	
	openOperateWindow({
		title: "修改采购合同",
		isUpdate: true,
		iframeAuto: true,
		url: "/admin/enterpriseManagement/procurementManagement/procurementContract/procurement-contract-update.jsp"
	})
})

function queryContract(id){
	this.contractId = id;
	openOperateWindow({
		title: "上传采购合同",
		width: "60%",
		height: "80%",
		url: "/admin/enterpriseManagement/procurementManagement/procurementContract/procurement-contract-fileupload.jsp"
	})
}